//
//  CHJCaptureDataSource.m
//  CHJVideoKit_Example
//
//  Created by jiaxuzhou on 2017/12/2.
//  Copyright © 2017年 jxzjxz. All rights reserved.
//

#import "CHJCaptureDataSource.h"
#import "CHJCaptureDefineHeader.h"
#import "UIDevice+Hardware.h"
#import "YXVideoEffectModel.h"

CHJCaptureDataSource *captureDataSource = nil;

@interface CHJCaptureDataSource ()

@property (nonatomic, strong) NSArray *aryVideoClips;

@end

@implementation CHJCaptureDataSource

+ (id)shareDataSource
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        captureDataSource = [[CHJCaptureDataSource alloc] init];
    });
    
    return captureDataSource;
}
- (void)setVideoClips:(NSArray *)ary
{
    self.aryVideoClips = ary;
}
- (NSArray *)getVideoClips
{
    return self.aryVideoClips;
}

+ (NSArray *)getLocalLvJingModels
{
    NSArray *models = nil;
    NSString *deviceName = [[UIDevice alloc] hardwareDescription];//获取机型
    BOOL is_low_5_seriers = ([deviceName isEqualToString:@"iPhone 5c (GSM)"] ||
                             [deviceName isEqualToString:@"iPhone 5c (Global)"] ||
                             [deviceName isEqualToString:@"iPhone 5 (GSM)"] ||
                             [deviceName isEqualToString:@"iPhone 5 (Global)"] ||
                             [deviceName isEqualToString:@"iPhone 4 (GSM Rev A)"] ||
                             [deviceName isEqualToString:@"iPhone 4 (CDMA)"] ||
                             [deviceName isEqualToString:@"iPhone 4S"]
                             );
    if (MPT_ScreenH > 480 && !is_low_5_seriers)
    {
        NSBundle *bundle = [NSBundle bundleForClass:self];
        
        NSString *bundlePath = [bundle pathForResource:@"newlut" ofType:@"bundle"];
        models = @[
                   [[YXVideoEffectModel alloc] initWithName:@"a_base" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"b3_meiyan" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"f6_bali" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"d11_meishi" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"e8_heibai" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"p13_xiyou" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"c14_fanqie" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"o15_bangbangtang" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"h16_moka" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"g17_jiaopian" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"i18_nuanyang" andPath:bundlePath],
                   ];
    }
    else
    {
        NSBundle *bundle = [NSBundle bundleForClass:self];

        NSString *bundlePath = [bundle pathForResource:@"filter" ofType:@"bundle"];
        models = @[
                   [[YXVideoEffectModel alloc] initWithName:@"filter_guodong" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"filter_naixi" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"filter_chuanyue" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"filter_senxi" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"filter_dongye" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"filter_chenfeng" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"filter_tonghua" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"filter_shishang" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"filter_wuhou" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"filter_huiyi" andPath:bundlePath],
                   [[YXVideoEffectModel alloc] initWithName:@"filter_wudu" andPath:bundlePath]];
    }
    
    return models;

}

@end
